<?php
namespace ctrl\demo;

use Sdk\GoodCang\callGCApiUtil;

class goodcang
{
    //获取仓库列表 http://ec.com/?c=demo_goodcang&a=warehouseList
    public static function warehouseList()
    {
        $action = '/public_open/base_data/get_warehouse';
        $data = [];
        $result = callGCApiUtil::callGCApi($action, 'POST', $data);
        echo '<pre />';
        print_r($result);
    }

    //获取拉取谷仓库存列表 http://ec.com/?c=demo_goodcang&a=pull
    public static function pull()
    {
        \serv\task\warehouse\goodcang::pull();
    }

    //获取拉取谷仓库存列表列列 http://ec.com/?c=demo_goodcang&a=pullQueue
    public static function pullQueue()
    {
        $string = '{"warehouse_id":"162","warehouse_code":"CZ"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\goodcang::pull($data);
        echo '<pre />';
        print_r($result);
    }

    //把拉以到的库存数据同步写到系统 http://ec.com/?c=demo_goodcang&a=stock
    public static function stock()
    {
        $string = '{"product_barcode":"G825-B001001-LG-FS","product_sku":"B001001-LG-FS","onway":"0","transfer_onway":0,"total_onway":0,"pending":"0","sellable":"0","unsellable":"0","reserved":"0","stocking":"0","pi_no_stock":"0","pi_freeze":"0","pi_warning_qty":"0","warehouse_desc":"澳洲墨尔本仓库","warehouse_code":"AU","shipped":"142","tune_out":"0","tune_in":"0","sold_shared":"0","product_sales_value":"0.00","product_freeze_status":0,"product_freeze_status_text":"正常","warehouse_id":"160"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\goodcang::check($data);
        var_dump($result);
    }
    
    
}